<div class="breadcrumb">
    <ul id="breadcrumb">
        <li><a href="<?php echo Configure::read('base_url');?>backstage" title="Home">
		<?php echo $this->Html->image("home.png", array("alt" => "Home",'class'=>'home','border'=>'0'));?>
		</a></li>
        <li><a href="<?php echo Configure::read('base_url');?>backstage/paymentmethods" title="Payment Methods">Payment Methods</a></li>
    </ul>
</div>
<?php echo $this->element('admin/admin_leftmenu'); ?>
<div id="left">
    <?php echo $this->Session->flash(); ?>
    <div class="div_header"><?php __('Manage Payment Methods'); ?></div>
    <div class="div_content">
        <table id="category_table" cellspacing="0" class="tablesorter">
            <thead>
                <tr>
                    <th width="50" >SL</th>
                    <th width="120" >Method Name</th>
                    <th width="60" style="text-align: center;">Actions</th>
                     <th width="60" style="text-align: center;">Status</th>
                </tr>
            </thead>
            <tbody>
                <?php
                $i = 0;
                //pr($category);
                foreach ($paymentmethods as $paymentmethod):
                    $class = null;
                    if ($i++ % 2 == 0) :
                        $class = ' class="alt"';
                ?>
                        <tr>
                            <td class="alt"><?php echo $i; ?></td>
                            <td class="alt"><?php echo $paymentmethod['Paymentmethod']['methodname']; ?></td>

                            <td align="center" class="alt">

                        <a href="javascript:void(0);" controller="paymentmethods" action="editsadmin" title="Edit" ElmID="<?php echo $paymentmethod['Paymentmethod']['id']; ?>" onclick='showPop(this)'>
<?php echo $this->Html->image("edit_gray.png", array("alt" => "Edit", 'border' => '0')); ?>
                        </a> </td>
                <td align="center" class="alt">
                 <?php
                if($paymentmethod['Paymentmethod']['status']==1){
                ?>
                <div id="status<?php echo $paymentmethod['Paymentmethod']['id']; ?>">
                <label>
                <input type="checkbox" checked="checked" name="isactive" onclick="return inactive('<?php echo $paymentmethod['Paymentmethod']['id']; ?>')"></label><div  style="display: inline;">active</div></div>
                <?php
                }else{
                ?>
                <div id="status<?php echo $paymentmethod['Paymentmethod']['id']; ?>">
                <label>
                <input type="checkbox" name="isactive" onclick="return active('<?php echo $paymentmethod['Paymentmethod']['id']; ?>')"></label><div style="display: inline;">inactive</div></div>
                <?php
                }
                ?>
                </td>
                   

                </tr>
<?php else: ?>
                <tr>
                    <td ><?php echo $i; ?></td>
                                <td ><?php echo $paymentmethod['Paymentmethod']['methodname']; ?></td>

                                <td align="center">
                                    
                 <a href="javascript:void(0);" controller="paymentmethods" action="editsadmin" title="Edit" ElmID="<?php echo $paymentmethod['Paymentmethod']['id']; ?>" onclick='showPop(this)'>
<?php echo $this->Html->image("edit_yellow.png", array("alt" => "Edit", 'border' => '0')); ?>
                            </a>
                                      
                        </td>
 <td align="center" >
                           <?php
                if($paymentmethod['Paymentmethod']['status']==1){
                ?>
                <div id="status<?php echo $paymentmethod['Paymentmethod']['id']; ?>">
                <label>
                <input type="checkbox" checked="checked" name="isactive" onclick="return inactive('<?php echo $paymentmethod['Paymentmethod']['id']; ?>')"></label><div  style="display: inline;">active</div></div>
                <?php
                }else{
                ?>
                <div id="status<?php echo $paymentmethod['Paymentmethod']['id']; ?>">
                <label>
                <input type="checkbox" name="isactive" onclick="return active('<?php echo $paymentmethod['Paymentmethod']['id']; ?>')"></label><div style="display: inline;">inactive</div></div>
                <?php
                }
                ?>
                        </td>

                    </tr>
<?php endif;
                        endforeach; ?>
                    <tbody>
                </table>
            </div>
            <div class="div_bottom"></div>
        </div>

        <!-- edit sidebar items here -->

        </div>

<?php echo $html->script(array("jquery.pagination.js")); ?>
<script type="text/javascript">

    jQuery(document).ready(function(){
        
    });
</script>
        <script type="text/javascript">
function active(id)
{
			jQuery.ajax({
				
				url : "<?php echo Configure::read('base_url');?>paymentmethods/active/"+id,
				
				success : function (html) {
					//jQuery("#html_textarea").hide();
					document.getElementById("status"+id).innerHTML = ""; 					
					jQuery("#status"+id).append(html);
				}
		   	});                
} 
</script>
<script type="text/javascript">
function inactive(id)
{
			//alert('sdfsdf');
                        //die();
                        jQuery.ajax({
				
				url : "<?php echo Configure::read('base_url');?>paymentmethods/inactive/"+id,
				
				success : function (html) {
					//jQuery("#html_textarea").hide();
					document.getElementById("status"+id).innerHTML = ""; 					
					jQuery("#status"+id).append(html);
				}
		   	});                
} 
</script>